<template>
    <MkBillList ref='drawerRef'>
        <MkQueryContainer>
            <template #header="">
                <MkForm ref="queryForm" :model="searchParam" :inline="true">
                    <MkInput label="关键字" @keyup.enter.native="search" v-model="searchParam.keyword" clearable="" />
                    <el-form-item>
                        <MkButtonQuery @click="search"> </MkButtonQuery>
                    </el-form-item>
                </MkForm>
            </template>
            <MkTable :data="tableData" v-loading="loading" @row-dblclick="edit">
                <MkColumnIndex />
                <MkColumn prop="id" label="单据号" />
                <MkColumn prop="danJuLeiXing" label="单据类型" />
                <MkColumn prop="danJuZhuangTai" label="单据状态" />
                <MkColumn prop="xueYeLaiYuanId" label="血液来源" />
                <MkColumn prop="laiYuanDanHao" label="来源单号" />
                <MkColumn prop="ruKuYuanQuId" label="入库院区" />
                <MkColumn prop="remark" label="备注" />
                <MkColumnOption @show="edit" :isMore="false" />
            </MkTable>
            <MkPagination v-model:page="searchParam.page" v-model:pageSize="searchParam.pageSize" :total="total"
                @query="search" />
        </MkQueryContainer>
    </MkBillList>
</template>

<script lang='ts' setup>
// 血液入库单
import { InvRuKuApi, InvRuKuOutput } from '/@/api/inv/InvRuKu';
import { usePageQuery } from '/@/hooks/usePageQuery'
import { clog, showSuccess } from '/@/utils'

const drawerRef = ref();
const emits = defineEmits(['load'])
const { searchParam, total, tableData, loading, search } = usePageQuery<InvRuKuOutput>(InvRuKuApi.page)

onMounted(() => {
    search();
})

const edit = (row: any) => {
    drawerRef.value?.close();
    emits('load', row)
}

const open = async () => {
    drawerRef.value.show();
};

defineExpose({ open })

</script>

<style lang='scss' scoped></style>